namespace NBody.Simulation
{
    using System;
    using System.Collections;
    
    public class HermiteParticle : Particle
    {
        private double acc_x;
        private double acc_y;
        private double acc_z;
        private double jerk_x;
        private double jerk_y;
        private double jerk_z;
        
        public HermiteParticle(double mass, double x, double y, double z, double vx, double vy, double vz) : base(mass, x, y, z, vx, vy, vz)
        {
            acc_x = 0.0;
            acc_y = 0.0;
            acc_z = 0.0;
            jerk_x = 0.0;
            jerk_y = 0.0;
            jerk_z = 0.0;
        }
        
        public HermiteParticle(Particle p) : base(p.Mass, p.X, p.Y, p.Z, p.Vx, p.Vy, p.Vz)
        {
            acc_x = acc_y = acc_z = 0.0;
            jerk_x = jerk_y = jerk_z = 0.0;
        }
        
        public double Acceleration(int i)
        {
            if (i == 0) return acc_x;
            else if (i == 1) return acc_y;
            else return acc_z;
        }
        
        public void SetAcceleration(double ax, double ay, double az)
        {
            acc_x = ax;
            acc_y = ay;
            acc_z = az;
        }
        
        public double Ax
        {
            get { return acc_x; }
        }
        
        public double Ay
        {
            get { return acc_y; }
        }
        
        public double Az
        {
            get { return acc_z; }
        }
        
        public double Jerk(int i)
        {
            if (i == 0) return jerk_x;
            else if (i == 1) return jerk_y;
            else return jerk_z;
        }
        
        public void SetJerk(double jx, double jy, double jz)
        {
            jerk_x = jx;
            jerk_y = jy;
            jerk_z = jz;
        }
        
        public double JerkX
        {
            get { return jerk_x; }
        }
        
        public double JerkY
        {
            get { return jerk_y; }
        }
        
        public double JerkZ
        {
            get { return jerk_z; }
        }
        
        public override string ToString()
        {
            string ret = base.ToString();
            ret += String.Format(" {0} {1} {2} {3} {4} {5}", acc_x, acc_y, acc_z, jerk_x, jerk_y, jerk_z);
            return ret;
        }
    }
}
